/*     */ package cn.com.hongpay.client.gen;
/*     */ 
/*     */ import cn.com.hongpay.client.utils.SignatureTools;
/*     */ import cn.com.hongpay.client.vo.bind.BindVo;
/*     */ import cn.com.hongpay.client.vo.pay.SinglePayNotifyResVo;
/*     */ import cn.com.hongpay.client.vo.pay.SinglePayVo;
/*     */ import cn.com.hongpay.client.vo.query.QueryVo;
/*     */ import cn.com.hongpay.client.vo.refund.RefundVo;
/*     */ 
/*     */ public class ReqMsgGenerate extends XmlGenerate
/*     */ {
/*     */   private String pfxFile;
/*     */   private String pfxPwd;
/*     */   private String privateKeyPwd;
/*     */   private String charset;
/*     */ 
/*     */   public String getCharset()
/*     */   {
/*  23 */     return this.charset;
/*     */   }
/*     */ 
/*     */   public void setCharset(String charset) {
/*  27 */     this.charset = charset;
/*     */   }
/*     */ 
/*     */   public ReqMsgGenerate(String pfxFile, String pfxPwd, String privateKeyPwd)
/*     */   {
/*  37 */     this.pfxFile = pfxFile;
/*  38 */     this.pfxPwd = pfxPwd;
/*  39 */     this.privateKeyPwd = privateKeyPwd;
/*     */   }
/*     */ 
/*     */   public String generatePayMsg(SinglePayVo payVo)
/*     */     throws Exception
/*     */   {
/*  51 */     String payXmlSource = getPayXml(payVo);
/*     */ 
/*  54 */     String payXmlSign = "";
/*  55 */     if ((this.charset != null) && (this.charset.trim().length() > 0))
/*  56 */       payXmlSign = SignatureTools.sign(payXmlSource, this.charset, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     else {
/*  58 */       payXmlSign = SignatureTools.sign(payXmlSource, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     }
/*     */ 
/*  62 */     return payXmlSource.replaceAll("<SIGNED_MSG></SIGNED_MSG>", "<SIGNED_MSG>" + payXmlSign + "</SIGNED_MSG>");
/*     */   }
/*     */ 
/*     */   public String generateQueryMsg(QueryVo queryVo)
/*     */     throws Exception
/*     */   {
/*  74 */     String queryXmlSource = getQueryXml(queryVo);
/*     */ 
/*  77 */     String queryXmlSign = "";
/*  78 */     if ((this.charset != null) && (this.charset.trim().length() > 0))
/*  79 */       queryXmlSign = SignatureTools.sign(queryXmlSource, this.charset, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     else {
/*  81 */       queryXmlSign = SignatureTools.sign(queryXmlSource, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     }
/*     */ 
/*  85 */     return queryXmlSource.replaceAll("<SIGNED_MSG></SIGNED_MSG>", "<SIGNED_MSG>" + queryXmlSign + "</SIGNED_MSG>");
/*     */   }
/*     */ 
/*     */   public String generateRefundMsg(RefundVo refundVo)
/*     */     throws Exception
/*     */   {
/*  96 */     String refundXmlSource = getRefundXml(refundVo);
/*     */ 
/*  99 */     String refundXmlSign = "";
/* 100 */     if ((this.charset != null) && (this.charset.trim().length() > 0))
/* 101 */       refundXmlSign = SignatureTools.sign(refundXmlSource, this.charset, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     else {
/* 103 */       refundXmlSign = SignatureTools.sign(refundXmlSource, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     }
/*     */ 
/* 107 */     return refundXmlSource.replaceAll("<SIGNED_MSG></SIGNED_MSG>", "<SIGNED_MSG>" + refundXmlSign + "</SIGNED_MSG>");
/*     */   }
/*     */ 
/*     */   public String generateBindMsg(BindVo bindVo)
/*     */     throws Exception
/*     */   {
/* 118 */     String bindXmlSource = getBindXml(bindVo);
/*     */ 
/* 121 */     String bindXmlSign = "";
/* 122 */     if ((this.charset != null) && (this.charset.trim().length() > 0))
/* 123 */       bindXmlSign = SignatureTools.sign(bindXmlSource, this.charset, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     else {
/* 125 */       bindXmlSign = SignatureTools.sign(bindXmlSource, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     }
/*     */ 
/* 129 */     return bindXmlSource.replaceAll("<SIGNED_MSG></SIGNED_MSG>", "<SIGNED_MSG>" + bindXmlSign + "</SIGNED_MSG>");
/*     */   }
/*     */ 
/*     */   public String generatePayNotifyResMsg(SinglePayNotifyResVo notifyResVo)
/*     */   {
/* 140 */     String resXmlSource = getPayNotifyResXml(notifyResVo);
/*     */ 
/* 144 */     String resXmlSign = "";
/* 145 */     if ((this.charset != null) && (this.charset.trim().length() > 0))
/* 146 */       resXmlSign = SignatureTools.sign(resXmlSource, this.charset, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     else {
/* 148 */       resXmlSign = SignatureTools.sign(resXmlSource, this.pfxFile, this.pfxPwd, this.privateKeyPwd);
/*     */     }
/*     */ 
/* 152 */     return resXmlSource.replaceAll("<SIGNED_MSG></SIGNED_MSG>", "<SIGNED_MSG>" + resXmlSign + "</SIGNED_MSG>");
/*     */   }
/*     */ }

/* Location:           F:\hongpay_client.jar
 * Qualified Name:     cn.com.hongpay.client.gen.ReqMsgGenerate
 * JD-Core Version:    0.6.0
 */